#include <stdio.h>
#include <string.h>

void ppp(char (*a)[29]) {
    for (int i=0; i<7; i++) {
    printf("a: %s\n", a[i]);

    }
}

void juck(char *dd){

}

int main(void){
    char xx[7][29] = {"zbcde", "bbbeee"};

    printf("xx:%p  xx[0]:%p &xx[0]%p xx=xx[0]:%d\n", xx, xx[0], &xx[0], *xx == xx[0]);

    printf("xx[0] == xx:%d\n", xx == &xx[0]);

    printf("xx[0][0]:%c **xx:%c *xx[0]:%c\n", xx[0][0], **xx, *xx[0]);

    putchar('\n');
    putchar('\n');

    ppp(xx);


    int *bb[2];

    puts("mutidimensional array and point!");

    printf("bb[1]: %p\n", bb[1]);

    int cc[2];
    printf("cc[1]: %d\n", cc[1]);

    int (*dd)[2];

    printf("dd:%p\n", dd);
    //printf("*dd:%d\n", **dd);


    int *a;
    double *b;

    //b = a;

    int **p2;
    int *pt;

    p2=&pt;

    printf("pt:%p p2:%p, &pt:%p\n", pt, p2, &pt);

    const int n = 10;

    const int *x;

    x = &n;

    printf("n:%d\n", *x);


    int m=19;
    int *pm = &m;

    const int *pn ;
    /*printf("pn:%p\n", pn);
    pn = pm;

    printf("pm:%p, pn:%p\n", pm, pn);

    printf("pm:%d, pn:%d\n", *pm, *pn);

    m=20;

    printf("pm:%d, pn:%d\n", *pm, *pn);
*/
    int l = 100;

    int *pl;

    pn = pl;


    pl = &l;

    pn = pl;

    l = 999;

    printf("pm:%p, pn:%p\n", pl, pn);

    printf("pm:%d,\n pn:%d\n", *pl, *pn);



    char chr[5] = "abcd";

    printf("chr %s\n", chr);

    chr[1] = 0;

    printf("chr %s\n", chr);

    for (int i=0; i<4; i++) {
        printf("chr[%d]: %c %d\n", i, chr[i], chr[i]);
    }

    printf("strlen(chr): %lu\n", strlen(chr));

    putchar('\n');
    char chr2[5] = {65};

    sprintf(chr2, "%*s", 4, " ");

    for (int i=0; i<4; ++i) {
        printf("chr2[%d]:%c %d\n", i, chr2[i], chr2[i]);
    }



    char a1[12]={0};
    char a2[] = "abc\0de\0hahaha";

    char *a3 = "block";
    int a4 =100;
    double a5 = 1.0;

    printf("strlen(a1):%lu\n", strlen(a1));
    puts(a1);
    strcat(a1, a2);
    printf("strcat(a1, a2):%s\n",a1);

    printf("strlen(a1):%lu\n", strlen(a1));
    int  add = 12;

    char *a11 = a2;
    a11++;
    a11++;
    strcpy(a1, a11);
    printf("strcpy(a1,a2):%s\n",a1);

    const char *tt="ab";

    printf("strlen(a1):%lu\n", strlen(a1));

    a1[2] = 0;

    printf("strlen(a1):%lu\n", strlen(a1));
}




